<!-- HTML header for doxygen 1.8.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Connection Control Functions</title>
<title>Using the µVision Socket Interface: Connection Control Functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="drv.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="drv.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="keilarm.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">Using the µVision Socket Interface
   &#160;<span id="projectnumber">Application Note 198</span>
   </div>
   <div id="projectbrief">Control and monitor µVision via the built-in TCP/IP interface</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Usage&#160;and&#160;Description</span></a></li>
      <li><a href="modules.html"><span>Reference</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__uvsc__ctrl__func.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Connection Control Functions<div class="ingroups"><a class="el" href="group__uvsc__func.html">Client Functions</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gac3372cf6ae5b1f3bed207527f8b28720"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__usvc__defs.html#gaa98bd3356e69afadc44d005d3c7bbbf3">_UVSC_FUNC_</a> void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__uvsc__ctrl__func.html#gac3372cf6ae5b1f3bed207527f8b28720">UVSC_Version</a> (UINT *pUVSCVersion, UINT *pUVSOCKVersion)</td></tr>
<tr class="separator:gac3372cf6ae5b1f3bed207527f8b28720"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1810ba2b32a5e91e3f53bd23bc75c2d5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__usvc__defs.html#gaa98bd3356e69afadc44d005d3c7bbbf3">_UVSC_FUNC_</a> <a class="el" href="group__usvc__enums.html#gadadac39a0d05bddb1eb1240c1eeb1ecc">UVSC_STATUS</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__uvsc__ctrl__func.html#ga1810ba2b32a5e91e3f53bd23bc75c2d5">UVSC_Init</a> (int uvMinPort, int uvMaxPort)</td></tr>
<tr class="separator:ga1810ba2b32a5e91e3f53bd23bc75c2d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8f518330fe4842e2a29492cf20f49575"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__usvc__defs.html#gaa98bd3356e69afadc44d005d3c7bbbf3">_UVSC_FUNC_</a> <a class="el" href="group__usvc__enums.html#gadadac39a0d05bddb1eb1240c1eeb1ecc">UVSC_STATUS</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__uvsc__ctrl__func.html#ga8f518330fe4842e2a29492cf20f49575">UVSC_UnInit</a> (void)</td></tr>
<tr class="separator:ga8f518330fe4842e2a29492cf20f49575"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4d5d8f897604d8b3e8b6ec03150b92db"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__usvc__defs.html#gaa98bd3356e69afadc44d005d3c7bbbf3">_UVSC_FUNC_</a> <a class="el" href="group__usvc__enums.html#gadadac39a0d05bddb1eb1240c1eeb1ecc">UVSC_STATUS</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__uvsc__ctrl__func.html#ga4d5d8f897604d8b3e8b6ec03150b92db">UVSC_OpenConnection</a> (char *name, int *iConnHandle, int *pPort, char *uvCmd, <a class="el" href="group__usvc__enums.html#ga49745755375db102e66a92d2284d1edc">UVSC_RUNMODE</a> uvRunmode, <a class="el" href="group__usvc__typedefs.html#ga7df8d5de58c0a72d7ccc4de61ac46b8f">uvsc_cb</a> callback, void *cb_custom, char *logFileName, <a class="el" href="group__uvsock__typedefs.html#ga3e89f2d425245466b27ba3600b116a22">xBOOL</a> logFileAppend, <a class="el" href="group__usvc__typedefs.html#gaf8d09a4de76a8b25ad9189805b527751">log_cb</a> logCallback)</td></tr>
<tr class="separator:ga4d5d8f897604d8b3e8b6ec03150b92db"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga04490f7bc377dca9f36fa19cf65f8532"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__usvc__defs.html#gaa98bd3356e69afadc44d005d3c7bbbf3">_UVSC_FUNC_</a> <a class="el" href="group__usvc__enums.html#gadadac39a0d05bddb1eb1240c1eeb1ecc">UVSC_STATUS</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__uvsc__ctrl__func.html#ga04490f7bc377dca9f36fa19cf65f8532">UVSC_CloseConnection</a> (int iConnHandle, <a class="el" href="group__uvsock__typedefs.html#ga3e89f2d425245466b27ba3600b116a22">xBOOL</a> terminate)</td></tr>
<tr class="separator:ga04490f7bc377dca9f36fa19cf65f8532"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5971c6014321a7250fbbfc4434aafa4c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__usvc__defs.html#gaa98bd3356e69afadc44d005d3c7bbbf3">_UVSC_FUNC_</a> <a class="el" href="group__usvc__enums.html#gadadac39a0d05bddb1eb1240c1eeb1ecc">UVSC_STATUS</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__uvsc__ctrl__func.html#ga5971c6014321a7250fbbfc4434aafa4c">UVSC_ConnHandleFromConnName</a> (char *name, int *iConnHandle)</td></tr>
<tr class="separator:ga5971c6014321a7250fbbfc4434aafa4c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2de6d2554403594841261d5dad14893e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__usvc__defs.html#gaa98bd3356e69afadc44d005d3c7bbbf3">_UVSC_FUNC_</a> <a class="el" href="group__usvc__enums.html#gadadac39a0d05bddb1eb1240c1eeb1ecc">UVSC_STATUS</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__uvsc__ctrl__func.html#ga2de6d2554403594841261d5dad14893e">UVSC_GetLastError</a> (int iConnHandle, <a class="el" href="group__operation__codes.html#ga99cef9125743ebfba84222416cdeb368">UV_OPERATION</a> *msgType, <a class="el" href="group__status__codes.html#gafd133b241db7cac0f1baaac6c492c5ee">UV_STATUS</a> *status, char *str, int maxStrLen)</td></tr>
<tr class="separator:ga2de6d2554403594841261d5dad14893e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga083a4b4ab04135be42147fa7451b13c4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__usvc__defs.html#gaa98bd3356e69afadc44d005d3c7bbbf3">_UVSC_FUNC_</a> <a class="el" href="group__usvc__enums.html#gadadac39a0d05bddb1eb1240c1eeb1ecc">UVSC_STATUS</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__uvsc__ctrl__func.html#ga083a4b4ab04135be42147fa7451b13c4">UVSC_LogControl</a> (int iConnHandle, <a class="el" href="group__uvsock__typedefs.html#ga3e89f2d425245466b27ba3600b116a22">xBOOL</a> enableRaw, <a class="el" href="group__uvsock__typedefs.html#ga3e89f2d425245466b27ba3600b116a22">xBOOL</a> enableTrace)</td></tr>
<tr class="separator:ga083a4b4ab04135be42147fa7451b13c4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Description</h2>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga04490f7bc377dca9f36fa19cf65f8532"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__usvc__defs.html#gaa98bd3356e69afadc44d005d3c7bbbf3">_UVSC_FUNC_</a> <a class="el" href="group__usvc__enums.html#gadadac39a0d05bddb1eb1240c1eeb1ecc">UVSC_STATUS</a> UVSC_CloseConnection </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>iConnHandle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__uvsock__typedefs.html#ga3e89f2d425245466b27ba3600b116a22">xBOOL</a>&#160;</td>
          <td class="paramname"><em>terminate</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Close a connection to a uVision session </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">iConnHandle</td><td>Handle for the connection, as returned by <a class="el" href="group__uvsc__ctrl__func.html#ga4d5d8f897604d8b3e8b6ec03150b92db">UVSC_OpenConnection</a> </td></tr>
    <tr><td class="paramname">terminate</td><td>Pass 'xTRUE' to terminate uVision. This parameter is ignored and the session is automatically terminated if it was auto-started </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="UVSC__C_8h.html#gadadac39a0d05bddb1eb1240c1eeb1ecca3809ecb6c637725dfc3f832439113905" title="Success. ">UVSC_STATUS_SUCCESS</a> on success, or an error code</dd></dl>
<p>This function closes a connection to a uVision session. If the session was auto-started it is automatically terminated. If it was not auto-started, it can be terminated, or left running. </p>

</div>
</div>
<a class="anchor" id="ga5971c6014321a7250fbbfc4434aafa4c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__usvc__defs.html#gaa98bd3356e69afadc44d005d3c7bbbf3">_UVSC_FUNC_</a> <a class="el" href="group__usvc__enums.html#gadadac39a0d05bddb1eb1240c1eeb1ecc">UVSC_STATUS</a> UVSC_ConnHandleFromConnName </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>iConnHandle</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Get a connection handle (<em>iConnHandle</em>) from a connection name </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">name</td><td>Pointer to a zero terminated string containing a unique connection name. The name should correspond to a name that was previously passed to <a class="el" href="group__uvsc__ctrl__func.html#ga4d5d8f897604d8b3e8b6ec03150b92db">UVSC_OpenConnection</a>. This pointer must not be NULL </td></tr>
    <tr><td class="paramname">iConnHandle</td><td>Pointer to a variable to contain the handle assigned to this connection. The value assigned will be invalid if the function returns an error. This pointer must not be NULL </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="UVSC__C_8h.html#gadadac39a0d05bddb1eb1240c1eeb1ecca3809ecb6c637725dfc3f832439113905" title="Success. ">UVSC_STATUS_SUCCESS</a> on success, or an error code</dd></dl>
<dl class="section pre"><dt>Precondition</dt><dd><a class="el" href="group__uvsc__ctrl__func.html#ga4d5d8f897604d8b3e8b6ec03150b92db">UVSC_OpenConnection</a> must have been called successfully</dd></dl>
<p>Use this function to convert a connection name to a connection handle (<em>iConnHandle</em>) to be used with other UVSC API functions. </p>

</div>
</div>
<a class="anchor" id="ga2de6d2554403594841261d5dad14893e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__usvc__defs.html#gaa98bd3356e69afadc44d005d3c7bbbf3">_UVSC_FUNC_</a> <a class="el" href="group__usvc__enums.html#gadadac39a0d05bddb1eb1240c1eeb1ecc">UVSC_STATUS</a> UVSC_GetLastError </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>iConnHandle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__operation__codes.html#ga99cef9125743ebfba84222416cdeb368">UV_OPERATION</a> *&#160;</td>
          <td class="paramname"><em>msgType</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__status__codes.html#gafd133b241db7cac0f1baaac6c492c5ee">UV_STATUS</a> *&#160;</td>
          <td class="paramname"><em>status</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>str</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>maxStrLen</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Retreive detailed information on the last UVSOCK error. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">iConnHandle</td><td>Handle for the connection, as returned by <a class="el" href="group__uvsc__ctrl__func.html#ga4d5d8f897604d8b3e8b6ec03150b92db">UVSC_OpenConnection</a> </td></tr>
    <tr><td class="paramname">msgType</td><td>Pointer to a variable to contain the UVSOCK message that caused the error </td></tr>
    <tr><td class="paramname">status</td><td>Pointer to a variable to contain status code of the UVSOCK message that caused the error </td></tr>
    <tr><td class="paramname">str</td><td>Pointer to a buffer to contain the zero terminated error string of the UVSOCK message that caused the error </td></tr>
    <tr><td class="paramname">maxStrLen</td><td>Size of the buffer pointer to by <em>str</em> (bytes) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="UVSC__C_8h.html#gadadac39a0d05bddb1eb1240c1eeb1ecca3809ecb6c637725dfc3f832439113905" title="Success. ">UVSC_STATUS_SUCCESS</a> on success, or an error code</dd></dl>
<dl class="section pre"><dt>Precondition</dt><dd><a class="el" href="group__uvsc__ctrl__func.html#ga4d5d8f897604d8b3e8b6ec03150b92db">UVSC_OpenConnection</a> must have been called successfully </dd>
<dd>
The last call to UVSC_XXXX should have returned an error</dd></dl>
<p>Use this function to get extended error information when a UVSC command function (eg <a class="el" href="group__uvsc__dbg__func.html#ga7e8be5c668700d24083317788fee45e7">UVSC_DBG_CALC_EXPRESSION</a>) fails. It is thread-safe and returns the last error for the calling thread, not the last error for the entire connection, so should be called from the same thread as the UVSC command function that caused the error. </p>

</div>
</div>
<a class="anchor" id="ga1810ba2b32a5e91e3f53bd23bc75c2d5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__usvc__defs.html#gaa98bd3356e69afadc44d005d3c7bbbf3">_UVSC_FUNC_</a> <a class="el" href="group__usvc__enums.html#gadadac39a0d05bddb1eb1240c1eeb1ecc">UVSC_STATUS</a> UVSC_Init </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>uvMinPort</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>uvMaxPort</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Initialize UVSC </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">uvMinPort</td><td>Minimum port avialable to the automatic port allocator. This must not be smaller than <a class="el" href="group__usvc__defs.html#ga17caa190343ed24573c5bafc034c54d5">UVSC_MIN_AUTO_PORT</a> </td></tr>
    <tr><td class="paramname">uvMaxPort</td><td>Maximum port avialable to the automatic port allocator. This must not be larger than <a class="el" href="group__usvc__defs.html#ga54e54a65c3bd512555f7467d1178e585">UVSC_MAX_AUTO_PORT</a></td></tr>
  </table>
  </dd>
</dl>
<p>Initialize UVSC with this function, which must be called prior to any other UVSC function, except <a class="el" href="group__uvsc__ctrl__func.html#gac3372cf6ae5b1f3bed207527f8b28720">UVSC_Version</a>. The function also verifies whether the port range <code>(uvMaxPort - uvMinPort)</code> can handle the maximum defined client connections (<a class="el" href="group__usvc__defs.html#ga35297034e80e69c6cbd24351e30f1008">UVSC_MAX_CLIENTS</a>). </p>
<div class="fragment"><div class="line">(uvMaxPort - uvMinPort) &lt; <a class="code" href="group__usvc__defs.html#ga35297034e80e69c6cbd24351e30f1008">UVSC_MAX_CLIENTS</a>)</div>
</div><!-- fragment --> <dl class="section see"><dt>See Also</dt><dd><ul>
<li><a class="el" href="group__uvsc__ctrl__func.html#ga4d5d8f897604d8b3e8b6ec03150b92db">UVSC_OpenConnection</a></li>
<li><a class="el" href="group__usvc__defs.html#ga58554e35b437d804e0f5182c661584e7">UVSC_PORT_AUTO</a> </li>
</ul>
</dd></dl>

</div>
</div>
<a class="anchor" id="ga083a4b4ab04135be42147fa7451b13c4"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__usvc__defs.html#gaa98bd3356e69afadc44d005d3c7bbbf3">_UVSC_FUNC_</a> <a class="el" href="group__usvc__enums.html#gadadac39a0d05bddb1eb1240c1eeb1ecc">UVSC_STATUS</a> UVSC_LogControl </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>iConnHandle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__uvsock__typedefs.html#ga3e89f2d425245466b27ba3600b116a22">xBOOL</a>&#160;</td>
          <td class="paramname"><em>enableRaw</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__uvsock__typedefs.html#ga3e89f2d425245466b27ba3600b116a22">xBOOL</a>&#160;</td>
          <td class="paramname"><em>enableTrace</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Control message logging </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">iConnHandle</td><td>Handle for the connection, as returned by <a class="el" href="group__uvsc__ctrl__func.html#ga4d5d8f897604d8b3e8b6ec03150b92db">UVSC_OpenConnection</a> </td></tr>
    <tr><td class="paramname">enableRaw</td><td>Pass 'xTRUE' to enable logging of raw UVSOCK data, or 'xFALSE' to disable it. The default option on connection is 'xFALSE' </td></tr>
    <tr><td class="paramname">enableTrace</td><td>Pass 'xTRUE' to enable logging of UVSC function trace, or 'xFALSE' to disable it. The default option on connection is 'xTRUE' </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="UVSC__C_8h.html#gadadac39a0d05bddb1eb1240c1eeb1ecca3809ecb6c637725dfc3f832439113905" title="Success. ">UVSC_STATUS_SUCCESS</a> on success, or an error code</dd></dl>
<dl class="section pre"><dt>Precondition</dt><dd><a class="el" href="group__uvsc__ctrl__func.html#ga4d5d8f897604d8b3e8b6ec03150b92db">UVSC_OpenConnection</a> must have been called successfully </dd>
<dd>
Logging should be enabled for this connection handle (ie one or both of <em>logFileName</em> and <em>logCallback</em> passed to <a class="el" href="group__uvsc__ctrl__func.html#ga4d5d8f897604d8b3e8b6ec03150b92db">UVSC_OpenConnection</a> should not be NULL)</dd></dl>
<p>Use this function to control what information is logged via the log file or logging callback. </p>

</div>
</div>
<a class="anchor" id="ga4d5d8f897604d8b3e8b6ec03150b92db"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__usvc__defs.html#gaa98bd3356e69afadc44d005d3c7bbbf3">_UVSC_FUNC_</a> <a class="el" href="group__usvc__enums.html#gadadac39a0d05bddb1eb1240c1eeb1ecc">UVSC_STATUS</a> UVSC_OpenConnection </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>iConnHandle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>pPort</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>uvCmd</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__usvc__enums.html#ga49745755375db102e66a92d2284d1edc">UVSC_RUNMODE</a>&#160;</td>
          <td class="paramname"><em>uvRunmode</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__usvc__typedefs.html#ga7df8d5de58c0a72d7ccc4de61ac46b8f">uvsc_cb</a>&#160;</td>
          <td class="paramname"><em>callback</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>cb_custom</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>logFileName</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__uvsock__typedefs.html#ga3e89f2d425245466b27ba3600b116a22">xBOOL</a>&#160;</td>
          <td class="paramname"><em>logFileAppend</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__usvc__typedefs.html#gaf8d09a4de76a8b25ad9189805b527751">log_cb</a>&#160;</td>
          <td class="paramname"><em>logCallback</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Open a connection to uVision session </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">name</td><td>Pointer to a zero terminated string containing a unique connection name. This name can be used later to retrieve the connection handle (<em>iConnHandle</em>) via the <a class="el" href="group__uvsc__ctrl__func.html#ga5971c6014321a7250fbbfc4434aafa4c">UVSC_ConnHandleFromConnName</a> function. If a connection name is not required this parameter should be NULL </td></tr>
    <tr><td class="paramname">iConnHandle</td><td>Pointer to a variable to contain the handle assigned to this connection. The value assigned will be invalid if the function returns an error. This pointer must not be NULL </td></tr>
    <tr><td class="paramname">pPort</td><td>Pointer to a variable containing the port of an existing uVision session to connect, or the value <a class="el" href="group__usvc__defs.html#ga58554e35b437d804e0f5182c661584e7">UVSC_PORT_AUTO</a> to auto-start a uVision session for this connection. If the function returns successfully, this variable will contain the port that was used for the connection. This pointer must not be NULL. </td></tr>
    <tr><td class="paramname">uvCmd</td><td>Pointer to a zero terminated string containing the path to a uVision executable to be started automatically for this connection. If uVision is not being auto-started this parameter is ignored and should be NULL </td></tr>
    <tr><td class="paramname">uvRunmode</td><td>Indicates the mode uVision should be started in when auto-started. If uVision is not being auto-started this parameter is ignored </td></tr>
    <tr><td class="paramname">callback</td><td>Pointer to a function to receive callbacks from UVSC. The callbacks provide notification of asynchronous UVSOCK messages, connection events, and errors relating to the connection. NOTE: UVSC_xxx API functions must not be called from the callback. To call a UVSC_xxx function in response to the callback, a notification must be passed another thread, which can then call the UVSC_xxx function. </td></tr>
    <tr><td class="paramname">cb_custom</td><td>This pointer will be returned in the calls to the callback function. It may be used for any purpose, but a common usage is for keeping track of the 'this' pointer of a C++ object relating to the connection </td></tr>
    <tr><td class="paramname">logFileName</td><td>Pointer to a zero terminated string containing the path to a file to use for logging UVSOCK messages for this connection for debug purposes. If a debugging log file is not required, this parameter should be NULL </td></tr>
    <tr><td class="paramname">logFileAppend</td><td>Pass 'xTRUE' to append to the log file specified in <em>logFileName</em>, or 'xFALSE' to overwrite the file. If <em>logFileName</em> is NULL, this parameter is ignored </td></tr>
    <tr><td class="paramname">logCallback</td><td>Pointer to a function to receive logging callbacks. These callbacks contain the same information that is entered into the log file. If this callback is not required, this parameter should be NULL </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="UVSC__C_8h.html#gadadac39a0d05bddb1eb1240c1eeb1ecca3809ecb6c637725dfc3f832439113905" title="Success. ">UVSC_STATUS_SUCCESS</a> on success, or an error code</dd></dl>
<dl class="section pre"><dt>Precondition</dt><dd><a class="el" href="group__uvsc__ctrl__func.html#ga1810ba2b32a5e91e3f53bd23bc75c2d5">UVSC_Init</a> must have been called successfully</dd></dl>
<p>This function opens a connection to a uVision session. The session can be either an existing session, or UVSC can automatically start a new session.</p>
<p><b>To auto-start a new uVision session (recommended):</b></p>
<ul>
<li><em>pPort</em> must be <a class="el" href="group__usvc__defs.html#ga58554e35b437d804e0f5182c661584e7">UVSC_PORT_AUTO</a> </li>
<li><em>uvCmd</em> must be the path to a valid uVision executable that supports UVSOCK</li>
</ul>
<p>Auto-starting uVision has the following advantages:</p>
<ul>
<li>uVision is in a known state from the beginning of the connection </li>
<li>uVision can be started in a special mode, that restricts how a user can interact with the remotely controlled session </li>
<li>If the uVision session is terminated by an application other than UVSC, UVSC automatically restarts the uVision session </li>
<li>uVision starts hidden from the user, and can remain that way for the whole session, operating silently in the background, if necessary </li>
<li>The uVision session is a sub-process of UVSC, and can therefore be reliably terminated by UVSC when the connection is closed</li>
</ul>
<p><b>To connect to an exisiting uVision session (not recommended):</b></p>
<ul>
<li><em>pPort</em> must be the UVSOCK port number of the existing uVision session </li>
<li><em>uvCmd</em> must be NULL </li>
</ul>

</div>
</div>
<a class="anchor" id="ga8f518330fe4842e2a29492cf20f49575"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__usvc__defs.html#gaa98bd3356e69afadc44d005d3c7bbbf3">_UVSC_FUNC_</a> <a class="el" href="group__usvc__enums.html#gadadac39a0d05bddb1eb1240c1eeb1ecc">UVSC_STATUS</a> UVSC_UnInit </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Uninitialize UVSC</p>
<dl class="section pre"><dt>Precondition</dt><dd><a class="el" href="group__uvsc__ctrl__func.html#ga1810ba2b32a5e91e3f53bd23bc75c2d5">UVSC_Init</a> should have been called successfully</dd></dl>
<p>Call this function to uninitialize <b>UVSC</b>. This function should be called before the UVSC library is unloaded from memory. All connected sessions will be automatically disconnected. </p>

</div>
</div>
<a class="anchor" id="gac3372cf6ae5b1f3bed207527f8b28720"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__usvc__defs.html#gaa98bd3356e69afadc44d005d3c7bbbf3">_UVSC_FUNC_</a> void UVSC_Version </td>
          <td>(</td>
          <td class="paramtype">UINT *&#160;</td>
          <td class="paramname"><em>pUVSCVersion</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">UINT *&#160;</td>
          <td class="paramname"><em>pUVSOCKVersion</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Get the library and interface versions </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">pUVSCVersion</td><td>Pointer to a variable to contain the UVSC library version </td></tr>
    <tr><td class="paramname">pUVSOCKVersion</td><td>Pointer to a variable to contain the UVSOCK interface version</td></tr>
  </table>
  </dd>
</dl>
<p>Returns the UVSC library and UVSOCK interface versions for this library.</p>
<p>The UINT version is converted to an X.YY version number by the following formula: </p>
<pre> X.YY = UV3_SOCKIF_VERS / 100 </pre><p>For example: </p>
<pre> *pUVSOCKVersion = 201 ==&gt; V2.01 </pre><p>This function can be used before initializing the interface with <a class="el" href="group__uvsc__ctrl__func.html#ga1810ba2b32a5e91e3f53bd23bc75c2d5">UVSC_Init</a>. </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Mon Jul 2 2018 08:45:40 for Using the µVision Socket Interface by ARM Ltd. All rights reserved.
	<!--
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 
	-->
	</li>
  </ul>
</div>
</body>
</html>
